package com.atguigu.mapjoin;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;
import java.net.URI;

public class MJDriver {
    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
        Job job = Job.getInstance(new Configuration());
        job.setJarByClass(MJDriver.class);

        job.setMapperClass(MJMapper.class);
        job.setNumReduceTasks(0);

        // file:/C:/Users/HongChaoZheng/.IntelliJIdea2019.3/system/captureAgent/debugger-agent.jar
        job.addCacheFile(URI.create("file:///D:/project/mapreduce/data/groupingComparator/reducerJoin/input/pd.txt"));

        FileInputFormat.setInputPaths(job,new Path("D:\\project\\mapreduce\\data\\groupingComparator\\reducerJoin\\input\\order.txt"));
        FileOutputFormat.setOutputPath(job,new Path("D:\\project\\mapreduce\\data\\groupingComparator\\mapJoin\\output"));

        boolean b = job.waitForCompletion(true);
        System.out.println(b ? 0:1);
    }
}
